package com.hotel.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hotel.dao.GoodsMapper;
import com.hotel.dao.LegacyMapper;
import com.hotel.entity.Goods;
import com.hotel.entity.Legacy;
import com.hotel.service.GoodsService;
@Service("goodsService")
@Transactional("txManager")
public class GoodsServiceImpl implements GoodsService {

	@Resource
	private GoodsMapper goodsMapper;
	
	@Resource
	private LegacyMapper legacyMapper;
	
	@Override
	public int deleteByPrimaryKey(Integer goodsId) {
		return goodsMapper.deleteByPrimaryKey(goodsId);
	}

	@Override
	public int insert(Goods record) {
		return goodsMapper.insert(record);
	}

	@Override
	public Goods selectByPrimaryKey(Integer goodsId) {
		return goodsMapper.selectByPrimaryKey(goodsId);
	}

	@Override
	public int updateByPrimaryKey(Goods record) {
		return goodsMapper.updateByPrimaryKey(record);
	}

	@Override
	public List<Goods> findAllGoodsByPage(Integer pageNo, Integer pageSize) {
		return goodsMapper.findAllGoodsByPage((pageNo-1)*pageSize, pageSize);
	}

	@Override
	public List<Legacy> findAllLegacyByPage(Integer pageNo, Integer pageSize) {
		return legacyMapper.findAllLegacyByPage((pageNo-1)*pageSize, pageSize);
	}

}
